<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title>XXX水疗管理系统</title>
		<link href="<c:url value="/resources/css/style.css" />" rel="stylesheet" type="text/css">
		<link href="<c:url value="/resources/css/default/easyui.css" />" rel="stylesheet" type="text/css">
		<script type="text/javascript" src="<c:url value="/resources/js/jquery-1.7.2.js" />"></script>
		<script type="text/javascript" src="<c:url value="/resources/js/jquery.easyui.min.js" />"></script>
		<script type="text/javascript" src="<c:url value="/resources/js/easyui-lang-zh_CN.js" />"></script>
		<script type="text/javascript">
		if(top!=window){
			top.location.href = window.location.href;
		}
			function submitForm(){
				if($.trim($("#loginUser").val()) == '' || $.trim($("#loginUser").val()) == '工号/登录名'){
					alert("请填写工号或登录名!");
					$("#loginUser").focus();
					return false;
				} 
				
				if($.trim($("#password").val()) == ''){
					alert("请填写密码!");
					$("#password").focus();
					return false;
				}
				
				$("#classes").val($("#classSel").combobox('getValue'));
				
				$("#loginForm").submit();
			}
			
			function clearForm(){
				$("#loginUser").val('工号/登录名');
				$("#password").val('');
			}
			
			function manageForm(){
				if($.trim($("#loginUser").val()) == '' || $.trim($("#loginUser").val()) == '工号/登录名'){
					alert("请填写工号或登录名!");
					$("#loginUser").focus();
					return false;
				} 
				
				if($.trim($("#password").val()) == ''){
					alert("请填写密码!");
					$("#password").focus();
					return false;
				}
				
				$("#loginForm").attr('action', 'manageLogin');
				$("#loginForm").submit();
			}
			
			function keyLogin(e){		
			  if (e.keyCode==13){  //回车键的键值为13
				  submitForm();
			  }
			}
		</script>
	</head>
	
	<body onkeydown="keyLogin(event)">
		<form name="loginForm" id="loginForm" method="post" action="login">
			
			<c:if test="${error_info != null}">
				<font color="red">${error_info}</font>
			</c:if>
			
			<div class="easyui-panel" title="登录" style="width:400px;text-align: center;">
				<div style="padding:10px 0 10px 60px">
					<table>
			    		<tr>
			    			<td style="text-align: right;">员工编号:</td>
			    			<td>
			    				<input id="loginUser" name="loginUser" style="width: 150px;color:grey;" class="easyui-validatebox" type="text" name="name" data-options="required:true" onblur="this.className='link_color';if (this.value=='') {this.value='工号/登录名'}" 
	      								onfocus="this.className='link_color'; if(this.value=='工号/登录名') {this.value=''}"  value="工号/登录名"/>
			    			</td>
			    		</tr>
			    		
			    		<tr>
			    			<td style="text-align: right;">密码:</td>
			    			<td>
			    				<input id="password" name="password" style="width: 150px;" class="easyui-validatebox" type="password" name="password" data-options="required:true" />
			    			</td>
			    		</tr>
			    		
			    		<tr>
			    			<td style="text-align: right;">班次:</td>
			    			<td>
			    				<select name="classSel" id="classSel" class="easyui-combobox" data-options="panelHeight:'auto'">
			    					<c:forEach var="code" items="${classesList}">
	    								<option value="${code.name}">${code.name}</option>	
	    							</c:forEach>
			    				</select>
			    				<input type="hidden" name="classes" id="classes" />
			    			</td>
			    		</tr>
			    	</table>
				</div>
				
				<div style="text-align:center;padding:5px">
		    		<a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()">登录</a>
		    		<a href="javascript:void(0)" class="easyui-linkbutton" onclick="manageForm()">管理员</a>
		    		<a href="javascript:void(0)" class="easyui-linkbutton" onclick="clearForm()">重置</a>
		    	</div>
			</div>
		
		</form>
	</body>
</html>